package main

import (
	"fmt"
	"github.com/MingOf/logger"
	"github.com/MingOf/tcpSticky/proto"
	"net"
)

var log = logger.NewLogger("Info", "console", 0)

func main() {
	fmt.Println("writing")
	conn, err := net.Dial("tcp", "127.0.0.1:20000")
	if err != nil {
		log.Error(err)
		return
	}
	defer conn.Close()
	for i := 0; i < 20; i++ {
		pkg, err := proto.Encode("Hello Sticky Tcp?")
		if err != nil {
			log.Error(err)
			return
		}
		log.Info(pkg)
		_, err = conn.Write(pkg)
		if err != nil {
			log.Error(err)
		}
	}
}
